﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="view.aspx.cs" Inherits="OnLineExam.Web.view" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>查看成绩</title>
    <link href="assets/layui/2.2.5/css/layui.css" rel="stylesheet" />

    <link href="../../assets/easyui/1.5.4.4/themes/bootstrap/easyui.css" rel="stylesheet" />
    <link href="../../assets/easyui/1.5.4.4/themes/icon.css" rel="stylesheet" />

    <script src="../../assets/easyui/1.5.4.4/jquery.min.js"></script>
    <script src="../../assets/easyui/1.5.4.4/jquery.easyui.min.js"></script>
    <script src="../../assets/easyui/1.5.4.4/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend><%= PaperName %></legend>
    </fieldset>
    <div id="view">
    </div>
    <script>
        function isEmpty(obj){
        obj=obj+'';
        obj=$.trim(obj);
    if(typeof obj == "undefined" || obj == null || obj == ""||obj=='null'){
        return true;
    }else{
        return false;
    }
}
    </script>

    <script id="demo" type="text/html">
          
        <ul class="layui-timeline">
            {{#  layui.each(d.rows, function(index, item){ }}
            <li class="layui-timeline-item">
                <i class="layui-icon layui-timeline-axis"></i>
                <div class="layui-timeline-content layui-text">
                    <h3 class="layui-timeline-title">({{ item.QuestionTypeStr }}){{ item.Title }}</h3>
                    <p>
                        {{#  if(item.QuestionType <= 1 ){ }}
   
                       
        <br>
                        {{#  if(!isEmpty(item.Question.AnswerA)){ }}
{{ item.Question.AnswerA }} 
{{#  }  }}
 

                      
        <br>
{{ item.Question.AnswerB }}  
                         <br>
{{ item.Question.AnswerC }}  
                         <br>
{{ item.Question.AnswerD }}  
                   
  {{#  } }} 
                     {{#  if(item.QuestionType === 1 ){ }}
    
                        
      
               {{#  if(!isEmpty(item.Question.AnswerE)){ }}
  <br>{{ item.Question.AnswerE }} 
{{#  }  }}          
        
{{#  if(!isEmpty(item.Question.AnswerF)){ }}
<br>{{ item.Question.AnswerF }} 
{{#  }  }}       

{{#  if(!isEmpty(item.Question.AnswerG)){ }}
<br>   {{ item.Question.AnswerG }} 
{{#  }  }}     
                   
                   
  {{#  } }} 

     <!-- 判断题-->

                        {{#  if(item.QuestionType ===2 ){ }}
   
                       
        <br>
                        {{ item.Title }}    
        
                   
  {{#  } }} 

      <!-- 填空题-->

                        {{#  if(item.QuestionType ===3 ){ }}
   
                       
        <br>
                        {{ item.Question.FrontTitle }}  ___ {{ item.Question.BackTitle }}    
        
                   
  {{#  } }} 

     <!-- 问答题-->

                        {{#  if(item.QuestionType ===4 ){ }}
   
                       
        <br>
                        {{ item.Title }}      
        
                   
  {{#  } }} 


     <br />
                      答案<span class="layui-badge">{{ item.Question.Answer }}</span>作答<span class="layui-badge">{{ item.UserAnswer1 }}</span>得分<span class="layui-badge">{{ item.UserMark }}</span>
                    </p>
                </div>
            </li>
            {{#  }); }}
        </ul>

      
 

        
    </script>

    <script src="assets/layui/2.2.5/layui.all.js"></script>
    <script>
        var userId = '<%=User.Identity.Name%>';
        var scoreId = '<%=Request.QueryString["id"] %>';
        var qtype = "";
        layui.use('laytpl', function () {
            var laytpl = layui.laytpl;

            $.getJSON("handler/userAnswerHandler.ashx?qtype=&id=" + scoreId + '&type=getlist', function (rps) {


                var getTpl = demo.innerHTML
                    , view = document.getElementById('view');
                laytpl(getTpl).render(rps, function (html) {
                    view.innerHTML = html;
                });
            });


        });



    </script>



    <script>

        $(function () {
            $('#tt').datagrid({

                idField: 'ID',
                url: "handler/userAnswerHandler.ashx?c=<%=DateTime.Now.ToString("ffffff")%>",
                queryParams: { "qtype": qtype, "id": scoreId, "type": "getlist" },
                singleSelect: true, sortName: 'QuestionTypeStr', sortOrder: "asc",
                width: 'auto', height: 'auto',
                columns: [[
                    //{ field: 'ID', title: '序号' },
                    //{ field: 'UserID', title: '工号' },
                    //{ field: 'PaperName', title: '试卷' },
                    { field: 'QuestionTypeStr', title: '类型', sort: true },

                    { field: 'Title', title: '题目' },
                    { field: 'Question', title: '选项' },
                    { field: 'QuestionAnswer', title: '答案' },
                    { field: 'UserAnswer1', title: '作答' },
                    { field: 'UserMark', title: '得分' },                    { field: 'ExamTime', title: '时间' }
                ]]
            });


        });

    </script>
</body>
</html>
